package com.xmb.wcapi.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xmb.wcapi.constant.LayTableR;
import com.xmb.wcapi.entity.Department;
import com.xmb.wcapi.entity.SysConfig;
import com.xmb.wcapi.mapper.MesDepMapper;
import com.xmb.wcapi.mapper.SysConfigMapper;
import com.xmb.wcapi.service.ISysConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 配置 服务实现类
 * </p>
 *
 * @author huangping
 * @since 2024-05-28
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {

    @Autowired
    MesDepMapper depMapper;

    @Override
    public LayTableR getMesDepList(Integer page, Integer limit, String depName) {
        List<Department> mesDepList = depMapper.getMesDepList(new Page<>(page, limit), depName);
        for (Department department : mesDepList) {
            department.setStrDepartmentName(department.getStrDepartmentName().replace("课",""));
        }
        return LayTableR.result(0,mesDepList.size(),mesDepList);
    }
}
